#include "processBar.h"
#include <unistd.h>
typedef void (*callback_pb)(int);

void download(callback_pb pb)
{
  int total = 1000;
  int cur =0;
  while(cur <= total)
  {
    usleep(50000);
    int rate = cur*100/total;
    pb(rate);
    cur+=10;
  }
}

int main()
{
  printf("download 1:\n");
  download(processBar);
  printf("download 2:\n");
  initProcessBar();
  download(processBar);
  printf("download 3:\n");
  initProcessBar();
  download(processBar); 
  printf("download 4:\n");
  initProcessBar();
  download(processBar);
  printf("download 5:\n");
  initProcessBar();
  download(processBar);
  
  
  
  
  return 0;
}
